bitkeeper revision 1.1215 (42142daa9YHoIs3M6QPvH1qZYBJO5g)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 17 Feb 2005 05:37:46 +0000 (05:37 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 17 Feb 2005 05:37:46 +0000 (05:37 +0000)
IDT fixes. Initialise IDT sanely on x86/64. On x86/32 try to keep
per-cpu IDTs in sync better.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/boot/x86_64.S
xen/arch/x86/traps.c

index 2b89d9caa42dcfb6ba54b0b8eb6ee47fb4519785..ab729da99439129b8951bcbb88e9541b08f766d6 100644 (file)
@@ -148,15 +148,22 @@ __high_start:
         rep     stosb
 
         /* Initialise IDT with simple error defaults. */
-        lea     ignore_int(%rip),%rdx
-        mov     $(__HYPERVISOR_CS64 << 16),%eax
-        mov     %dx,%ax            /* selector = 0x0010 = cs */
-        mov     $0x8E00,%dx        /* interrupt gate - dpl=0, present */
-        lea     idt_table(%rip),%rdi
-        mov     $256,%rcx
-1:      mov     %eax,(%rdi)
-        mov     %edx,4(%rdi)
-        add     $8,%rdi
+        leaq    ignore_int(%rip),%rcx
+        movl    %ecx,%eax
+        andl    $0xFFFF0000,%eax
+        orl     $0x00008E00,%eax
+        shlq    $32,%rax
+        movl    %ecx,%edx
+        andl    $0x0000FFFF,%edx
+        orl     $(__HYPERVISOR_CS64<<16),%edx
+        orq     %rdx,%rax
+        shrq    $32,%rcx
+        movl    %ecx,%edx
+        leaq    idt_table(%rip),%rdi
+        movl    $256,%ecx
+1:      movq    %rax,(%rdi)
+        movq    %rdx,8(%rdi)
+        addq    $16,%rdi
         loop    1b
 
         /* Pass off the Multiboot info structure to C land. */
@@ -167,15 +174,6 @@ __high_start:
         call    __start_xen
         ud2     /* Force a panic (invalid opcode). */
 
-/* This is the default interrupt handler. */
-int_msg:
-        .asciz "Unknown interrupt\n"
-ignore_int:
-        cld
-        lea     int_msg(%rip),%rdi
-        call    SYMBOL_NAME(printf)
-1:      jmp     1b
-
         .code32
 
         .org    0x1e0
@@ -250,5 +248,16 @@ ENTRY(idle_pg_table_l2)
 ENTRY(cpu0_stack)
 
         .org 0x4000 + STACK_SIZE
+        .code64
 ENTRY(stext)
 ENTRY(_stext)
+
+/* This is the default interrupt handler. */
+int_msg:
+        .asciz "Unknown interrupt\n"
+ignore_int:
+        cld
+        leaq    int_msg(%rip),%rdi
+        call    SYMBOL_NAME(printf)
+1:      jmp     1b
+
index da2ed5cd50e36ac76eefb84226d449c2645f58db..341b7b5dd1ed912c1aecafbe3626e8c18bddb977 100644 (file)
@@ -68,7 +68,7 @@ char opt_nmi[10] = "fatal";
 string_param("nmi", opt_nmi);
 
 /* Master table, used by all CPUs on x86/64, and by CPU0 on x86/32.*/
-idt_entry_t idt_table[IDT_ENTRIES] = { {0, 0}, };
+idt_entry_t idt_table[IDT_ENTRIES];
 
 asmlinkage void divide_error(void);
 asmlinkage void debug(void);
@@ -714,7 +714,14 @@ asmlinkage int do_spurious_interrupt_bug(struct xen_regs *regs)
 
 void set_intr_gate(unsigned int n, void *addr)
 {
-    _set_gate(idt_table+n,14,0,addr);
+#ifdef __i386__
+    int i;
+    /* Keep secondary tables in sync with IRQ updates. */
+    for ( i = 1; i < NR_CPUS; i++ )
+        if ( idt_tables[i] != NULL )
+            _set_gate(&idt_tables[i][n], 14, 0, addr);
+#endif
+    _set_gate(&idt_table[n], 14, 0, addr);
 }
 
 void set_system_gate(unsigned int n, void *addr)